function parseQuery (query) {
  const reg = /([^=&\s]+)[=\s]*([^=&\s]*)/g;
  const obj = {};
  while (reg.exec(query)) {
    obj[RegExp.$1] = RegExp.$2;
  }
  return obj;
}

export default parseQuery;
